package com.cloudy.exception;

import com.cloudy.s3.response.error.ErrorResponseItemType;

public class S3AccessException extends AWSAccessException{
	private ErrorResponseItemType errorResponse;
	
	public S3AccessException() {
		super();
	}
	public S3AccessException(ErrorResponseItemType error) {
		super();
		this.setErrorResponse(error);
	}
	public S3AccessException(String message) {
		super(message);
	}
	
	public S3AccessException(Throwable throwable) {
		super(throwable);
	}
	public S3AccessException(String message, Throwable throwable) {
		super(message, throwable);
	}
	
	public void setErrorResponse(ErrorResponseItemType errorResponse) {
		this.errorResponse = errorResponse;
	}
	public ErrorResponseItemType getErrorResponse() {
		return errorResponse;
	}

	private static final long serialVersionUID = 1L;
	
	protected String getMessageFormErrorResponse() {
		if(errorResponse==null)
			return null;
		StringBuilder message = new StringBuilder();
			message.append(errorResponse.getCode()).append(": ").append(errorResponse.getMessage()).append("\n");
		return message.toString();
	}

}
